﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            SortedList<int, string> sortedList = new SortedList<int, string>();//根据键值排列

            sortedList.Add(1, "西瓜");
            sortedList.Add(3, "葡萄");
            sortedList.Add(2, "香蕉");




            foreach (KeyValuePair<int, string> item in sortedList)
            {
                Console.WriteLine(item.Key);
                Console.WriteLine(item.Value);

            }
        }
    }
}
